//
// Created by martics on 24-9-5.
//
#include "namespace.h"
#include "tools.h"
#include <stdio.h>

void setup_user_namespace(const pid_t pid) {
    char path[256];
    printf("Setting up user namespace...\n");

    sprintf(path, "/proc/%d/setgroups", pid);
    write_file(path, "deny\n");

    sprintf(path, "/proc/%d/uid_map", pid);
    write_file(path, "0 0 1\n");

    sprintf(path, "/proc/%d/gid_map", pid);
    write_file(path, "0 0 1\n");
}
